<?php


$config = include('config.php');

$redis = include('conn.php');

$action = isset($_GET["action"]) ? $_GET["action"] : "";
$p1 = isset($_GET['p1']) ? addslashes($_GET['p1']) : "";
$p2 = isset($_GET['p2']) ? addslashes($_GET['p2']) : "";
$p3 = isset($_GET['p3']) ? addslashes($_GET['p3']) : "";
$p4 = isset($_GET['p4']) ? addslashes($_GET['p4']) : "";
$p5 = isset($_GET['p5']) ? addslashes($_GET['p5']) : "";
//echo "<pre>";print_r($_GET);echo "</pre>";

if($action == "del"){
	$key = isset($_GET['key']) ? addslashes($_GET['key']) : "";
    $redis->delete($key);  
	exit(json_encode(array('code'=>1, 'info'=>'success')));
}else if($action == "dbSize"){
    $result = $redis->dbSize();
	print_r($result);exit;
}else if($action == "rename"){
    $result = $redis->rename($p1, $p2);
	var_dump($result);exit;
	
}else if($action == "renameNx"){
    $result = $redis->renameNx($p1, $p2);
	var_dump($result);exit;
	
}else if($action == "ping"){
    $result = $redis->ping();
	var_dump($result);exit;
}else if($action == "info"){
    $result = $redis->info();
	print_r($result);exit;
}else if($action == "bgrewriteaof"){
    $result = $redis->bgrewriteaof();
	print_r($result);exit;
}else if($action == "move"){
    $result = $redis->move($p1, $p2);
	var_dump($result);exit;
	
}else if($action == "save"){
    $result = $redis->save();
	var_dump($result);exit;
}else if($action == "bgsave"){
    $result = $redis->bgsave();
	var_dump($result);exit;
}else if($action == "lastSave"){
    $result = $redis->lastSave();
	var_dump($result);exit;
}else if($action == "flushdb"){
    $result = $redis->flushdb();
	var_dump($result);exit;
}else if($action == "redis_delete"){
    $result = $redis->delete($p1);
	var_dump($result);exit;
	
}else if($action == "expire"){
    $result = $redis->expire($p1, $p2);
	var_dump($result);exit;
	
}else if($action == "persist"){
    $result = $redis->persist($p1);
	var_dump($result);exit;
	
}else if($action == "exists"){
    $result = $redis->exists($p1);
	var_dump($result);exit;
	
}else if($action == "randomKey"){
    $result = $redis->randomKey();
	var_dump($result);exit;
}



?>
